package com.example.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    @Autowired
    private OtherSouce source;

    @GetMapping("/foo")
    public String foo() {
        MessageBuilder<String> builder = MessageBuilder.withPayload("Hello world");
        Message<String> message = builder.build();
        source.output().send(message);
        return "success";
    }
}
